Location_();
var user_name = getCookie("user_name");
$('.user_name').text(user_name);
//点击修改公司架构取消按钮
$('#cancel').click(function() {
	$('.view_pop').css('display', 'none');
})

$('.add_vigne').click(function() {
	$('#clue_source_platform').val("53客服")
	$('.add_clues').css('visibility', 'visible');
	$('.add_clues .content').css('transform', 'scale(1)');
	$('#form_add input').val("");
})

//点击放入线索池框
$('#owner_name').click(function() {
	$('.Trace_leader').css('visibility', 'visible');
	$('.Trace_leader .content').css('transform', 'scale(1)');
})

//点击线索负责人Cancel按钮
$('.Cancel').click(function() {
	$('.Trace_leader').css('visibility', 'hidden');
	$('.Trace_leader .content').css('transform', 'scale(0)');
})

//点击添加线索返回按钮
$('.return_add_clues').click(function() {
	$('.add_clues').css('visibility', 'hidden');
	$('.add_clues .content').css('transform', 'scale(0)');
	let ue = UE.getEditor('editorxg');
	ue.ready(function() {
		ue.setContent(""); //设置文本编辑器
	});
})

var departent_name;
var role_id;
//网谈table
layui.use(['jquery', 'layer', 'table', 'form', 'element', 'laydate', 'upload'], function() {
	var element = layui.element;
	var table = layui.table;
	var form = layui.form;
	var $ = layui.$ //重点处
		,
		layer = layui.layer;
	var laydate = layui.laydate;
	laydate.render({
		elem: '#time',
		range: true
	});
	laydate.render({
		elem: '#times',
	});
	function Res_done(res) {
		var perm = res.perm;
		var code = res.code;
		if(code == 204) {
			clearCookie();
			window.parent.top.location.reload();
		}
		$.each(perm, function(index, curr) {
			switch(curr.title) {
				case "53账号管理":
					$('.admin_gl').removeClass('hide');
					break;
				case "线索导入":
					$('.upload_to').removeClass('hide');
					break;
				case '线索添加':
					$('.add_vign_li').removeClass('hide');
					break;
				case '线索删除':
					$('.clue_dele').removeClass('hide');
					break;
				case '53账号导入':
					$('.upload_to_53').removeClass('hide');
					break;
				case '删除全部53':
					$('.add_dele').removeClass('hide');
					break;
				case '原始数据下载':
					$('.add_vign_down').removeClass('hide');
					break;
			}
		});
	};
	//线索添加表格
	table.render({
		elem: '#LAY_table_adduser',
		size: 'sm',
		url: "http://"+com_url+"//admin/dataCenter",
		response: {
			statusCode: 200
		},
		cols: [
			[{
				fixed: 'left',
				title: '序号',
				templet: '#zizeng',
				width: '3.6%',
			}, {
				field: 'clue_project',
				width: '5%',
				title: '咨询项目',
			}, {
				field: 'clue_area',
				width: '5%',
				title: '咨询地'
			}, {
				field: 'clue_code',
				width: '4%',
				title: '编号'
			}, {
				field: 'clue_number',
				width: '7.2%',
				title: '当天资源序号'
			}, {
				field: 'clue_unit',
				width: '5%',
				title: '下发部门'
			}, {
				field: 'clue_account_name',
				width: '10%',
				title: '账号'
			}, {
				field: 'category',
				width: '7%',
				title: '分类',
			}, {
				field: 'clue_source',
				width: '6.2%',
				title: '来源',
			}, {
				field: 'owner_name',
				width: '5.8%',
				title: '负责人'
			}, {
				field: 'create_name',
				width: '6%',
				title: '创建人'
			}, {
				field: 'create_time',
				width: '10%',
				title: '创建时间'
			}, {
				field: 'distribution_time',
				width: '10%',
				title: '下发时间'
			}, {
				field: 'right',
				width: '14.3%',
				toolbar: '#barDemo1',
				title: '操作'
			}]
		],
		page: true,
		even: true,
		limit: 10,
		id: 'adduser_table',
		done: function(res, count) { //回调函数
			Res_done(res);
		}
	});
	if(getPicTabNum) {
		$(".layui-tab-content>div").eq(getPicTabNum).addClass("layui-show").siblings().removeClass("layui-show");
	}
	// var ue = UE.getEditor('editorxg');

	//53账号管理
	function wsrender() {
		table.render({
			elem: '#LAY_table_account',
			size: 'sm',
			url: "http://"+com_url+"//admin/account",
			response: {
				statusCode: 200
			},
			cols: [
				[{
					fixed: 'left',
					checkbox: true,
				}, {
					field: 'account_name',
					width: '9.8%',
					title: '账号',
				}, {
					field: 'main_account',
					width: '12.5%',
					title: '主账号'
				}, {
					field: 'personal_account',
					width: '12.5%',
					title: '子账号'
				}, {
					field: 'full_account',
					width: '12.5%',
					title: '账号名称'
				}, {
					field: 'name',
					width: '11%',
					title: '备注'
				}, {
					field: 'numbering',
					width: '9.3%',
					title: '编号',
				}, {
					field: 'project',
					width: '9%',
					title: '项目',
				}, {
					field: 'right',
					width: '20%',
					toolbar: '#account_btn',
					title: '操作'
				}]
			],
			page: true,
			even: true,
			limit: 10,
			id: 'LAY_table_account_id',
			done: function(res, count) { //回调函数
				if(code == 204) {
					clearCookie();
					window.parent.top.location.reload();
				}
			}
		});

	}

	//点击线索添加查看修改ajax赋值
	table.on('tool(leaders)', function(obj) {
		var data = obj.data;
		if(obj.event === 'edit') {
			$('#owner_name').val(data.owner_name);
			$('#clue_project').val(data.clue_project);
			$('#clue_phone').val(data.clue_phone);
			$('#clue_area').val(data.clue_area);
			$('#clue_wechat').val(data.clue_wechat);
			$('#clue_qq').val(data.clue_qq);
			$('#clue_number').val(data.clue_number);
			$('#clue_unit').val(data.clue_unit);
			$('#clue_client').val(data.clue_client);
			$('#clue_account_name').val(data.clue_account_name);
			$('#clue_ip').val(data.clue_ip);
			$('#clue_coding').val(data.clue_coding);
			$('#clue_source_link').val(data.clue_source_link);
			$('#clue_key').val(data.clue_key);
			$('#clue_id').val(data.clue_id);
			$('#owner_role_id').val(data.owner_role_id);
			$('#clue_platform').val(data.clue_platform);
			var clue_category = data.clue_category;
			var clue_source = data.clue_source;
			$('#clue_source_platform').val("53客服");

			$('#clue_category,#clue_source').find('option').remove().end();
			var clue_category_demo = '<option value="0">网谈</option>' +
				'<option value="1">留言</option>'+
				'<option value="2">热线</option>';
				$('#clue_category').append(clue_category_demo);
				$("#clue_category option[value=" + clue_category + "] ").attr("selected", true);
				
				
			var clue_source_demo = '<option value="">--请选择--</option>' +
				'<option value="竞价">竞价</option>'+
				'<option value="批量">批量</option>'+
				'<option value="优化">优化</option>'+
				'<option value="微信">微信</option>'+
				'<option value="联展">联展</option>'+
				'<option value="留言">留言</option>';
				$('#clue_source').append(clue_source_demo);
				$("#clue_source option[value=" + clue_source + "] ").attr("selected", true);
				form.render('select');

			// $("#clue_category option[value=" + clue_category + "] ").attr("selected", true)
			// $("#clue_source option[value=" + clue_source + "] ").attr("selected", true)
			//			$("#clue_source_platform option[value=" + clue_source_platform + "] ").attr("selected", true)
			form.render('select')
			var clue_detailsxg = data.clue_details;
			if(clue_detailsxg != null) {
				let ue = UE.getEditor('editorxg');
				ue.ready(function() {
					ue.setContent(clue_detailsxg); //设置文本编辑器
				});
			}
			// else{
			// 	let ue = UE.getEditor('editorxg');
			// 	ue.ready(function() {
			// 		ue.setContent(clue_detailsxg); //设置文本编辑器
			// 	});
			// }

			$('.add_clues').css('visibility', 'visible');
			$('.add_clues .content').css('transform', 'scale(1)');
		} else if(obj.event === 'del') { //删除
			let clue_id = data.clue_id;
			layer.open({
				type: 1,
				title: "提示",
				skin: 'add_department_content',
				area: "200px",
				content: "确认删除么？",
				btnAlign: 'c',
				btn: ['确定', '取消'],
				btn1: function(index, curr) {
					$.ajax({
						type: 'get',
						beforeSend: cookie_val_fun,
						url: "http://"+com_url+"//admin/dataDel",
						data: {
							id: clue_id,
						},
						dataType: 'json',
						success: function(res) {
							var msg = res.msg;
							var code = res.code;
							if(code == "200") {
								layer.msg(msg, {
									icon: 1
								});
								$(".layui-laypage-btn")[0].click();
								layer.close(index);
							} else {
								layer.msg(msg, {
									icon: 0
								});
								layer.close(index);
							}
						}
					});
				}
			})
		} else if(obj.event === 'undate') {
			var un_client_id = data.client_id;
			var un_clue_phone = data.clue_phone;
			var clue_platform = data.clue_platform;
			$.ajax({
				type: 'get',
				beforeSend: cookie_val_fun,
				url: "http://"+com_url+"//admin/updateClient",
				data: {
					phone: un_clue_phone,
					client_id: un_client_id,
					clue_platform:clue_platform
				},
				dataType: 'json',
				success: function(res) {
					var msg = res.msg;
					var code = res.code;
					if(code == "200") {
						layer.msg(msg, {
							icon: 1
						});
					} else {
						layer.msg(msg, {
							icon: 0
						});
					}
				}
			});
		}
	});

	function input_empty() {
		$('#account_name').val("");
		$('#main_account').val("");
		$('#personal_account').val("");
		$('#full_account').val("");
		$('#name').val("");
		$('#numbering').val("");
		$('#projectt').val("");
		$('#appid').val("");
		$('#appsecret').val("");
	};

	function stataus_demo() {
		$("#status_val,#r_status").find('option').remove().end();
		var status_val_demo = '<option value="0">启用</option>' +
			'<option value="1">禁止</option>';
		var r_statusdemo = '<option value="1">启用</option>' +
			'<option value="0">禁止</option>';
		$("#status_val").append(status_val_demo);
		$("#r_status").append(r_statusdemo);
		form.render('select');
	}
	//53账号管理
	table.on('tool(account_admin)', function(obj) {
		var data = obj.data;
		if(obj.event === 'detail_admin') {
			var statuss = data.status;
			var r_status = data.r_status;
			stataus_demo();
			// if(statuss) {
			$("#status_val option[value=" + statuss + "] ").attr("selected", true)
			$("#r_status option[value=" + r_status + "] ").attr("selected", true)
			form.render('select');
			// };
			$('#account_name').val(data.account_name);
			$('#main_account').val(data.main_account);
			$('#personal_account').val(data.personal_account);
			$('#full_account').val(data.full_account);
			$('#name').val(data.name);
			$('#numbering').val(data.numbering);
			$('#projectt').val(data.project);
			$('#appid').val(data.appid);
			$('#appsecret').val(data.appsecret);
			layer.open({
				type: 1,
				title: '查看/修改信息',
				area: '400px',
				skin: 'add_department_content',
				content: $('#Edit_content'),
				btn: ['保存', '取消'],
				btn1: function(index, curr) {
					$.ajax({
						type: "post",
						beforeSend: cookie_val_fun,
						data: {
							id: data.id,
							account_name: $('#account_name').val(),
							main_account: $('#main_account').val(),
							personal_account: $('#personal_account').val(),
							full_account: $('#full_account').val(),
							name: $('#name').val(),
							numbering: $('#numbering').val(),
							project: $('#projectt').val(),
							appid: $('#appid').val(),
							appsecret: $('#appsecret').val(),
							status: $('#status_val option:selected').val(),
							r_status: $('#r_status option:selected').val()
						},
						url: "http://"+com_url+"//admin/editaccount",
						success: function(res) {
							var data = JSON.parse(res)
							var code = data.code;
							let msg = data.msg;
							if(code == "200") {
								layer.close(index);
								form.render('select')
								layer.msg(msg, {
									icon: 1
								});
								input_empty();
								table.reload('LAY_table_account_id', {
									page: {
										curr: 1 //重新从第 1 页开始
									},
									where: {
										phone: ""
									}
								});
							} else {
								layer.msg(msg, {
									icon: 2
								});
							}
						}
					});
				},
				btn2: function() {
					form.render('select');
					input_empty();
				},
				cancel: function() {
					form.render('select');
					input_empty();
				}
			})
		}
	});

	//添加内容提交
	form.on('submit(demos)', function(data) {
		let ue = UE.getEditor('editorxg');
		var txt;
		ue.ready(function() {
			//				ue.setContent('hello');//设置文本编辑器
			var html = ue.getContent();
			txt = ue.getPlainTxt();
		});
		data = data.field;
		if($('#clue_project').val() == "") {
			layer.msg("咨询项目不能为空！", {
				time: 1000,
				icon: 0
			})
			return false
		}
		if($('#clue_area').val() == "") {
			layer.msg("咨询地不能为空！", {
				time: 1000,
				icon: 0
			})
			return false
		}
		if($('#clue_platform').val() == "") {
			layer.msg("平台不能为空！", {
				time: 1000,
				icon: 0
			})
			return false
		}
		var lentht = $('#clue_source_link').val().length;
		// if(lentht > 200) {
		// 	layer.msg("咨询页面链接过长", {
		// 		time: 1000,
		// 		icon: 0
		// 	})
		// 	return false
		// }
		var index = layer.load(1, {
			shade: [0.5, '#fff'] //0.1透明度的白色背景
		});
		$.ajax({
			type: "post",
			beforeSend: function(request) {
				request.setRequestHeader("ApiAuth", cookie_val);
			},
			data: data,
			url: "http://"+com_url+"//admin/dataAdd",
			success: function(res) {
				var code = JSON.parse(res).code;
				let msg = JSON.parse(res).msg;
				layer.close(index);
				if(code == "200") {
					$('.add_clues').css('visibility', 'hidden');
					$('.add_clues .content').css('transform', 'scale(0)');
					$('#form_add input').val("");
					$(".layui-laypage-btn")[0].click();
					let ue = UE.getEditor('editorxg');
					ue.ready(function() {
						ue.setContent(""); //设置文本编辑器
					});
					setTimeout(function() {
						layer.msg(msg, {
							icon: 1
						})
					}, 300)
				} else{
					layer.msg(msg, {
						icon: 2
					})
				}
			}
		});
		return false;
	});

	//搜索功能
	var $ = layui.$,
		active = {
			pricipal_seach: function() {
				var select_name = $('#select_namess option:selected');
				var seclct_val = select_name.val();
				var user_val = $('#user_admin').val();
				//执行重载
				table.reload('admin_table', {
					page: {
						curr: 1 //重新从第 1 页开始
					},
					where: {
						departent: seclct_val,
						name: user_val
					}
				});
			},
			add_accunt: function() {
				stataus_demo();
				layer.open({
					type: 1,
					title: '添加账号',
					area: '400px',
					skin: 'add_department_content',
					content: $('#Edit_content'),
					btn: ['保存', '取消'],
					btn1: function(index, curr) {
						if($('#Edit_content input').val()) {
							$.ajax({
								type: "post",
								beforeSend: cookie_val_fun,
								data: {
									account_name: $('#account_name').val(),
									main_account: $('#main_account').val(),
									personal_account: $('#personal_account').val(),
									full_account: $('#full_account').val(),
									name: $('#name').val(),
									numbering: $('#numbering').val(),
									project: $('#projectt').val(),
									status: $('#status_val option:selected').val()
								},
								url: "http://"+com_url+"//admin/editaccount",
								success: function(res) {
									var data = JSON.parse(res)
									var code = data.code;
									let msg = data.msg;
									if(code == "200") {
										layer.close(index);
										form.render('select')
										layer.msg(msg, {
											icon: 1
										});
										$('#account_name').val("");
										$('#main_account').val("");
										$('#personal_account').val("");
										$('#full_account').val("");
										$('#name').val("");
										$('#numbering').val("");
										$('#projectt').val("");
										table.reload('LAY_table_account_id', {
											page: {
												curr: 1 //重新从第 1 页开始
											},
											where: {
												phone: ""
											}
										});
									} else {
										layer.msg(msg, {
											icon: 2
										});
									}
								}
							});
						} else {
							layer.msg("请认真填写，所有选项都不能为空", {
								icon: 0
							})
						}
					},
					btn2: function() {
						form.render('select');
						input_empty();
					}
				})
			},
			reload_sbm: function() {
				var index = layer.load(1, {
					shade: [0.5, '#fff'] //0.1透明度的白色背景
				});
				var unit = $('#unit').val();
				var project = $('#project').val();
				var phone = $('#phone').val();
				var code = $('#code').val();
				var time = $('#time').val();
				var account = $('#account').val();
				var name_fz = $('#name_fz').val();
				var create_name = $('#create_name').val();
				//执行重载
				table.reload('adduser_table', {
					page: {
						curr: 1 //重新从第 1 页开始
					},
					where: {
						unit: unit,
						project: project,
						phone: phone,
						code: code,
						time: time,
						account: account,
						name: name_fz,
						create_name:create_name
					},
					done: function(res) {
						layer.close(index);
						Res_done(res);
					}
				});
			},
			//53账号搜索
			reload_sbm_num: function() {
				var index = layer.load(1, {
					shade: [0.5, '#fff'] //0.1透明度的白色背景
				});
				var direct_num = $('#direct_num').val();
				var son_num = $('#son_num').val();
				//执行重载
				table.reload('LAY_table_account_id', {
					page: {
						curr: 1 //重新从第 1 页开始
					},
					where: {
						main: direct_num,
						personal: son_num,
					},
					done: function(res) {
						layer.close(index);
					}
				});
			},
			admin_gl: function() {
				wsrender();
			},
			add_vign_downtype: function() {
				layer.open({
					type: 1,
					title: "下载原始数据",
					area: "300px",
					content: $('#add_downs'),
					btnAlign: 'c',
					btn: ['下载', '取消'],
					btn1: function(index, curr) {
						var times = $('#times').val();
						if(times == '' || undefined) {
							layer.msg('日期不能为空', {
								icon: 0
							});
							return false;
						} else {
							$.ajax({
								type: 'get',
								beforeSend: cookie_val_fun,
								url: "http://"+com_url+"//admin/generate",
								data: {
									time: times,
								},
								dataType: 'json',
								success: function(res) {
									var down_url = res.data;
									var code = res.code;
									if(code == '200') {
										layer.close(index)
										window.location.href = "http://" + down_url;
										layer.msg('正在下载，请稍后·········', {
											icon: 1
										});
									}else{
										layer.msg('下载失败!', {
											icon: 0
										});
									}
								}
							});
						}
					}
				})
			},
			//全部删除
			add_dele: function() {
				var allcation_id = [];
				var checkStatus = table.checkStatus('LAY_table_account_id'),
					data = checkStatus.data;
				for(var i = 0; i < data.length; i++) {
					var idss = data[i].id;
					allcation_id.push(idss); //获取分配人的id
				};
				if(allcation_id==""){
					layer.msg("请勾选资源信息", {
						icon: 0
					});
					return false
				}
				layer.open({
					type: 1,
					title: "提示",
					skin: 'add_department_content',
					area: "200px",
					content: "确认删除么？",
					btnAlign: 'c',
					btn: ['确定', '取消'],
					btn1: function(index, curr) {
						$.ajax({
							type: 'post',
							beforeSend: cookie_val_fun,
							url: "http://"+com_url+"//admin/allDel",
							data:{
								id:allcation_id
							},
							dataType: 'json',
							success: function(res) {
								var msg = res.msg;
								var code = res.code;
								if(code == "200") {
									table.reload('LAY_table_account_id', {
										page: {
											curr: 1
										}
									});
									layer.msg(msg, {
										icon: 1
									});
									layer.close(index);
									allcation_id=[];
								} else {
									layer.msg(msg, {
										icon: 0
									});
									layer.close(index);
									allcation_id=[];
								}
							}
						});
					}
				})
			},
			//快速添加信息
			quick_add_type:function(){
				let ue = UE.getEditor('editorTj');
				function clear_val(){
//					$('#quick_add_textarea').val("");
					$('#quick_add_con').val("")
					$('#quick_add_href').val("");
					ue.ready(function() {
						ue.setContent(""); //设置文本编辑器
					});
				};
				layer.open({
					type: 1,
					title: "快速添加信息",
					skin: 'add_department_content',
					area: "400px",
					content: $('#quick_add_div'),
					btnAlign: 'c',
					btn: ['确定', '取消'],
					btn1: function(index, curr) {
						var ueck_content = UE.getEditor('editorTj').getContent();
						var top_shade = layer.load(1, {
							shade: [0.5, '#fff'] //0.1透明度的白色背景
						});
						var quick_xs_val = $('#quick_add_con').val();
						var quick_splitVal = quick_xs_val.split("\t")
						console.log(quick_splitVal)
						//资源页面链接val
						var quick_add_href_Val = $('#quick_add_href').val();
						if(quick_splitVal.length != '26'){
							layer.msg("线索信息不对", {
								icon: 0
							});
							return false;
						};
//						if(quick_add_href_Val == ""){
//							layer.msg("资源链接不能为空,请认真填写！", {
//								icon: 0
//							});
//							return false;
//						}
						$.ajax({
							type: 'post',
							beforeSend: cookie_val_fun,
							url: "http://"+com_url+"//admin/dataAdd",
							data:{
								clue_coding:quick_splitVal[1],
								clue_platform:quick_splitVal[17],
								clue_client:quick_splitVal[8],
								clue_area:quick_splitVal[10],
								clue_project:quick_splitVal[13],
								clue_phone:quick_splitVal[14],
								clue_qq:quick_splitVal[15],
								clue_account_name:quick_splitVal[12],
								clue_key:quick_splitVal[18],
								clue_unit:quick_splitVal[20],
								clue_source_link:$('#quick_add_href').val(),
								clue_details:ueck_content
							},
							dataType: 'json',
							success: function(res) {
								var msg = res.msg;
								var code = res.code;
								layer.close(top_shade)
								if(code == "200") {
									layer.msg(msg, {
										icon: 1
									});
									$(".layui-laypage-btn")[0].click();
									clear_val();
									layer.close(index)
								} else {
									clear_val();
									layer.msg(msg, {
										icon: 0
									});
									layer.close(index)
								}
							}
						});
					},
					btn2:function(){
						clear_val();
					},
					cancel:function(){
						clear_val();
					}
				})
			}
			
		};

	$('.quick_add_li,.layui-tab-title li,.add_vign_down,.add_accunt,#adduser_seachs,#adduser_seach,.searc,.add_dele').on('click', function() {
		var type = $(this).data('type');
		active[type] ? active[type].call(this) : '';
	});
	//	自动触发事件
	if(getPicTabNum) {
		$('.layui-tab-title li').eq(getPicTabNum).trigger('click')
	}

	//监听单元格事件
	var user_names;
	table.on('tool(leader)', function(obj) {
		var data = obj.data;
		var datas = JSON.parse(JSON.stringify(data))
		if(obj.event === 'setSign') {
			role_id = datas.role_id;
			var position_name = datas.name;
			user_names = datas.name;
			$('#owner_role_id').val(role_id);
		}
	});

	$('.OkBtn').click(function() {
		$('#owner_name').val(user_names);
		$('#owner_role_idbj').val(role_id);
		$('#owner_role_idtj').val(role_id);
		$('#owner_name1').val(user_names);
		if($('#owner_role_id').val()) {
			$('.Trace_leader').css('visibility', 'hidden');
			$('.Trace_leader .content').css('transform', 'scale(0)');
		} else {
			layer.msg("未选择负责人")
		}
	})

	var $ = layui.jquery,
		upload = layui.upload;
	//选完文件后不自动上传
	upload.render({
		method: 'post',
		elem: '#test8',
		response: {
			statusCode: 200
		},
		headers: {
			ApiAuth: cookie_val
		},
		url: "http://"+com_url+"//admin/dataExcel",
		exts: 'xls|XLSX',
		auto: false,
		accept: 'file',
		size: 20000,
		bindAction: '#test9',
		before: function() {
			index = layer.load(1, {
				shade: [0.5, '#fff'] //0.1透明度的白色背景
			});
		},
		done: function(res) {
			let msg = res.msg;
			layer.close(index);
			if(res.code == '200') {
				setTimeout(function() {
					layer.msg("上传成功", {
						icon: 1
					})
					layer.open({
						type: 1,
						title: "提示信息",
						skin: 'add_department_content',
						content: '<div>' + msg + '</div>',
						cancel: function(index, curr) {
							window.location.reload()
						}
					})
				}, 200)
			} else {
				layer.msg(msg, {
					icon: 0
				})
			}
		},
		error: function(res) {
			alert("数据库异常")
		},
	});

	//53文件上传
	upload.render({
		method: 'post',
		elem: '#test10',
		response: {
			statusCode: 200
		},
		headers: {
			ApiAuth: cookie_val
		},
		url: "http://"+com_url+"//admin/exlacc",
		exts: 'xls|XLSX',
		auto: false,
		accept: 'file',
		size: 20000,
		bindAction: '#test11',
		before: function() {
			index = layer.load(1, {
				shade: [0.5, '#fff'] //0.1透明度的白色背景
			});
		},
		done: function(res) {
			let msg = res.msg;
			layer.close(index);
			if(res.code == '200') {
				$(".layui-laypage-btn")[0].click();
				setTimeout(function() {
					layer.msg("上传成功", {
						icon: 1
					})
				}, 200)
				setTimeout(function() {
					window.location.reload()
				}, 600)
			} else {
				layer.msg(msg, {
					icon: 0
				})
			}
		},
		error: function(res) {
			alert("数据库异常")
		},
	});
});